package com.cast.service.Impl;

import com.cast.dao.UserDao;
import com.cast.domain.User;
import com.cast.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class UserServiceImpl  implements UserService {

    @Autowired
    private UserDao userDao;
    @Override
    public void addUser(String name, double money) {
        userDao.addUser(name,money);
    }

    @Override
    public void deleteByName(String name) {
        userDao.deleteByName(name);
    }

    @Override
    public void updateUser(User user) {
            userDao.updateUser(user);
    }

    @Override
    public List<User> findAall() {
        List<User> aall = userDao.findAall();
        return aall;
    }

    @Override
    public void deleteById(int id) {
        userDao.deleteById(id);
    }

    @Override
    public User findByName(String name) {
        User user = userDao.findByName(name);
        return user;
    }

    @Override
    public User findById(int id) {
        User user = userDao.findById(id);
        return user;
    }


}
